﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Yglab.Models;

namespace Yglab.Controllers
{
    public class AraController : Controller
    {

		  private YgContext conn = new YgContext();

        public ActionResult Index()
        {
            return View();
        }


		  public ActionResult YazarAra( string Ara = "" ) {

					 ViewBag.Ara = Ara;
					  List<Article> articleList = null;


					  articleList = conn.Articles.Include( "Author" ).Include( "Journal" ).Include( "Versionns" ).Where( a => a.Author.Name.Contains( Ara ) ).ToList();
					 
					
					 
					 ViewBag.Articles = articleList;

					 return View( articleList );
		  }

		  public ActionResult Yazar(  ) {

				return View();
		  }


		  public ActionResult DergiAra( string Ara = "" ) {

				ViewBag.Ara = Ara;
				List<Journal> journalList = null;

				journalList = conn.Journals.Include( "Editor" ).Include( "Sciences" ).Include( "Subjects" ).Where( a => a.Name.Contains( Ara ) ).ToList();

				return View( journalList );
		  }






		  public ActionResult Makale() {

				return View();
		  }


		  public ActionResult MakaleAra( string Ara = "" ) {

				ViewBag.Ara = Ara;
				List<Versionn> versionList = null;
				versionList = conn.Versionns.Include( "Article" ).Include( "Article.Author" ).Include( "Article.Journal" ).Include( "Sciences" ).Include( "Subjects" ).Where( a => a.Title.Contains( Ara ) || a.Abstract.Contains( Ara ) ).ToList();
				return View( versionList );
		  }










		  public ActionResult Dergi() {

				return View();
		  }








    }
}
